Sets or clears the read-only attribute on all files in a directory. Use to allow or prevent scripts from modifying files in the specified directory.
Syntax
SetAllFilesReadOnly("DirectoryPath", True/False, Recursive)
Arguments
| Argument | Description |
|---|---|
| DirectoryPath | Full path to the directory. See Identifying files and directories in statements for information about configuring full paths relative to the workspace or script directory. |
| True/False | True sets the read-only attribute on all files in the directory. False clears the read-only attribute to make files writable. |
| Recursive | Recursive attribute change. True changes the read-only attribute on all files in all subdirectories. False changes only the read-only attribute on files in the specified directory. If not specified, False is used. |
Example
'User-defined subroutine that deletes directories and all files in them
Sub SafeDelete(dirPath)
SetAllFilesReadOnly(dirPath, False, True) 'Makes all read-only files and subdirectories writable
DeleteDirectory(dirPath, True)
End Sub
SafeDelete("C:\\Testing")
SafeDelete("C:\\TempOutput")